
str = 'hello linux'
print(str)
str1 = str.replace('linux','python')
print(str1)

print('-'*20)

str = 'hello linux hello linux'
print(str)
str1 = str.replace('linux','python')
print(str1)

print('-'*20)

str = 'hello linux hello linux hello linux hello linux'
str1 = str.replace('linux','python',3) # 后面的数字代表要替换的个数
print(str1)